<?php

/**
 * This file is part of the Pagizer package.
 *
 * For the full copyright and license information, please view the LICENSE
 * file that was distributed with this source code.
 *
 * @copyright   Copyright (c) 2010 Advisa (http://www.advisa.fr)
 * @author      Pagizer Core Team <team@pagizer.org>
 * @package     pagizer
 * @subpackage  searchEngine
 */

class m_searchEngine_actions_block_front_SearchFieldAction extends f_core_Action
{
	public function execute()
	{
        $blockParams = $this->getBlockContext()->getParameters();

        $searchPage = f_target_Manager::getDocumentByUniqueTarget('searchPage', $this->getContext('currentWebsite')->getUniqueId(), $blockParams['blockLang']);

        if(!is_null($searchPage))
        {
            /* @var $searchPage m_website_documents_Page */
            $this->addToModel('href', $searchPage->getCompleteUrl());
        }
        else
        {
            $this->addToModel('href', '');
        }

        $this->addToModel('blockParams', $this->getBlockContext()->getParameters());
        $this->setView('success');
	}	
}